.PHONY:all
all:libself.so libself.a

libself.so:mymath_d.o myprint_d.o
	gcc -shared mymath_d.o myprint_d.o -o libself.so -std=c99
mymath_d.o:mymath.c
	gcc -c -fPIC mymath.c -o mymath_d.o -std=c99
myprint_d.o:myprint.c
	gcc -c -fPIC myprint.c -o myprint_d.o -std=c99

libself.a: mymath.o myprint.o
	ar -rc libself.a mymath.o myprint.o
mymath.o:mymath.c
	gcc -c mymath.c -o mymath.o -std=c99
myprint.o:myprint.c
	gcc -c myprint.c -o myprint.o -std=c99

.PHONY:lib_release
lib_release:
	mkdir -p librelease/include
	cp -rf *.h librelease/include
	mkdir -p librelease/lib
	cp -rf *.a librelease/lib
	cp -rf *.so librelease/lib

.PHONY:clean
clean:
	rm -rf *.o *.a *.so librelease

